//
//  SearchView.m
//  02weiBo
//
//  Created by jss on 16/4/24.
//  Copyright © 2016年 jss. All rights reserved.
//

#import "SearchView.h"
#import "UIView+JACKFrameExt.h"

@interface SearchView()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *textFliedRightContraint;

@property (weak, nonatomic) IBOutlet UIButton *calcelBtn;

@property (weak, nonatomic) IBOutlet UITextField *tf_textFiled;

@end

@implementation SearchView

-(void)awakeFromNib {
    [super awakeFromNib];
    NSLog(@"awake方法被掉用了");
    
    //避免图形被压扁 所以设置成正方形
    
  
}

//点击取消按钮
- (IBAction)didClickCancleBtn:(id)sender {
    //更改约束
    self.textFliedRightContraint.constant = 0;
    //执行动画
    [UIView animateWithDuration:0.25 animations:^{
        //重新布局
        [self layoutIfNeeded];
        
    }];
    
}

//textFiled将要编辑的时候调用
- (IBAction)textFiledBigenEdit:(id)sender {
    //点击修改约束
    self.textFliedRightContraint.constant = self.calcelBtn.frame.size.width + 2;
    //实现动画
    [UIView animateWithDuration:0.25 animations:^{
        
        //重新布局
        [self layoutIfNeeded];

    }];
}


@end
